{% extends 'base.html' %}
{% load static %}
{% block title %}服务器资源申请{% endblock title %}
{% block extra_style %}
  <link rel="stylesheet" type="text/css" href="{% static 'css/apply.css' %}">
{% endblock extra_style %}
{% block content %}
<h2 class="application-title">申请信息</h2>
<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
  {% csrf_token %}
  <p>{{ form.non_field_errors }}</p>
  <div class="form-group">
    {% with form.user_id as field %}
      <label class="col-sm-2 control-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
      <div class="col-sm-6">
        <input class="form-control" type="text" name="{{ field.html_name }}" readonly="readonly" id="{{ field.id_for_label }}" value="9527">
        {{ field.errors }}
      </div>
    {% endwith %}
  </div>
  <div class="form-group">
    {% with form.user_name as field %}
      <label class="col-sm-2 control-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
      <div class="col-sm-6">
        <input class="form-control" type="text" name="{{ field.html_name }}" readonly="readonly" id="{{ field.id_for_label }}" value="豆腐干">
        {{ field.errors }}
      </div>
    {% endwith %}
  </div>
  <div class="form-group">
    {% with form.user_email as field %}
      <label class="col-sm-2 control-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
      <div class="col-sm-6">
        <input class="form-control" type="email" name="{{ field.html_name }}" readonly="readonly" id="{{ field.id_for_label }}" value="xx@zhenai.com">
        {{ field.errors }}
      </div>
    {% endwith %}
  </div>
  <div class="form-group">
    {% with form.project_name as field %}
      <label class="col-sm-2 control-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
      <div class="col-sm-6">
        <input class="form-control" type="text" value="{{ field.value }}" name="{{ field.html_name }}" id="{{ field.id_for_label }}">
        {{ field.errors }}
      </div>
    {% endwith %}
  </div>
  <div class="form-group">
    {% with form.server_count as field %}
      <label class="col-sm-2 control-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
      <div class="col-sm-6">
        <input class="form-control" min="1" value="{{ field.value }}" type="number" name="{{ field.html_name }}" id="{{ field.id_for_label }}">
        {{ field.errors }}
      </div>
    {% endwith %}
  </div>
  <div class="form-group">
    {% with form.budget as field %}
      <label class="col-sm-2 control-label" for="{{ field.id_for_label }}">{{ field.label }}（元）</label>
      <div class="col-sm-6">
        <input class="form-control" min="1" value="{{ field.value }}" type="number" name="{{ field.html_name }}" id="{{ field.id_for_label }}">
        {{ field.errors }}
      </div>
    {% endwith %}
  </div>
  <div class="form-group">
    {% with form.detail_file as field %}
      <label class="col-sm-2 control-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
      <div class="col-sm-6">
        <input type="file" value="{{ field.value }}" name="{{ field.html_name }}" id="{{ field.id_for_label }}">
        {{ field.errors }}
      </div>
    {% endwith %}
  </div>
  <div class="form-group">
    {% with form.remark as field %}
      <label class="col-sm-2 control-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
      <div class="col-sm-6">
        <textarea class="form-control" placeholder="其他补充..." rows=4 name="{{ field.html_name }}" id="{{ field.id_for_label }}">{{ field.value }}</textarea>
      </div>
    {% endwith %}
  </div>
  <div class="form-group">
    {% with form.approver as field %}
      <label class="col-sm-2 control-label">{{ field.label }}</label>
      <div class="col-sm-6">
        {% for choice in field %}
          {{ choice }}
        {% endfor %}
        {{ field.errors }}
      </div>
    {% endwith %}
  </div>
    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-success">提交申请</button>
    </div>
  </div>
</form>
{% endblock content %}
{% block extra_script %}
  <script src="{% static 'js/apply.js' %}"></script>
{% endblock %}
